package com.bangbangu.account.dao.impl;

import org.hibernate.Criteria;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;

import java.util.List;

import com.bangbangu.account.dao.LoginDao;
import com.bangbangu.account.model.Account;

public class LoginDaoImpl implements LoginDao {

	private SessionFactory sessionFactory;
	
	@Override
	public List<Account> login(Account account) {
		Criteria criteria = sessionFactory.openSession().createCriteria(Account.class);
		criteria.add(Restrictions.eq("accountId", account.getAccountId()));
		return criteria.list();
		
	}

	public SessionFactory getSessionFactory() {
		return sessionFactory;
	}

	public void setSessionFactory(SessionFactory sessionFactory) {
		this.sessionFactory = sessionFactory;
	}
	
	
}
